package com.wander.io;

import java.io.*;
import java.nio.charset.Charset;

public class FileInputStreamExample {
    public static void main(String[] args) {
        File file = new File("d:\\code\\hello.txt");
        try {
            FileInputStream fis = new FileInputStream(file);
            Charset charset = Charset.forName("UTF-8");
            InputStreamReader reader = new InputStreamReader(fis, charset);
            int c = 0;
            while ((c = reader.read()) != -1) {
                System.out.print(c + "  ");
                System.out.println((char) c);
            }
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }
}
